package com.googlecode.jvmpart.support;

import java.util.HashMap;
import java.util.Map;

import com.googlecode.jvmpart.proc.JvmProcessException;

public abstract class SimplePartitioner extends AbsPartitioner{
	public Map<String, Map<String, Object>> doPartition() throws JvmProcessException {
		int totalJvmProcess = getTotalProcessor();
		Map<String, Map<String, Object>> params = new HashMap<String, Map<String, Object>>();
		for(int i=0;i<totalJvmProcess;i++) {
			int startInd = getStartIndex()+i;
			Map<String,Object> param = processorParams(startInd);
			params.put(getJvmProcessName()+startInd, param);
		}
		return params;
	}
	public int getStartIndex() {
		return 0;
	}
	public abstract int getTotalProcessor();
	public abstract Map<String,Object> processorParams(int index);
}
